<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>添加预约</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            background-color: #f5f5f5;
        }
        .container {
            max-width: 800px;
            margin: 0 auto;
            background-color: white;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        h1 {
            color: #333;
            margin-bottom: 20px;
        }
        .form-group {
            margin-bottom: 15px;
        }
        label {
            display: block;
            margin-bottom: 5px;
            color: #666;
        }
        input[type="text"],
        input[type="datetime-local"],
        textarea,
        select {
            width: 100%;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
        }
        textarea {
            height: 100px;
            resize: vertical;
        }
        .btn {
            display: inline-block;
            padding: 8px 15px;
            background-color: #4CAF50;
            color: white;
            text-decoration: none;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .btn:hover {
            background-color: #45a049;
        }
        .btn-cancel {
            background-color: #f44336;
            margin-left: 10px;
        }
        .btn-cancel:hover {
            background-color: #d32f2f;
        }
        .alert {
            padding: 15px;
            margin-bottom: 20px;
            border-radius: 4px;
        }
        .alert-danger {
            background-color: #f2dede;
            color: #a94442;
            border: 1px solid #ebccd1;
        }
        .venue-info {
            margin-top: 10px;
            padding: 10px;
            background-color: #f9f9f9;
            border-radius: 4px;
            display: none;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>添加预约</h1>
        
        <c:if test="${not empty error}">
            <div class="alert alert-danger">${error}</div>
        </c:if>
        
        <form action="${pageContext.request.contextPath}/reservation/add" method="post" id="reservationForm">
            <input type="hidden" name="venueId" value="${venue.id}" />

            <div class="form-group">
                <label>场馆名称：</label>
                <span>${venue.name}</span>
            </div>
            <div class="form-group">
                <label>位置：</label>
                <span>${venue.location}</span>
            </div>
            <div class="form-group">
                <label>容量：</label>
                <span>${venue.capacity}</span>
            </div>
            <div class="form-group">
                <label>状态：</label>
                <span>${venue.status == 'available' ? '可用' : '维护中'}</span>
            </div>
            
            <div class="form-group">
                <label for="startTime">开始时间</label>
                <input type="datetime-local" id="startTime" name="startTime" required>
            </div>
            
            <div class="form-group">
                <label for="endTime">结束时间</label>
                <input type="datetime-local" id="endTime" name="endTime" required>
            </div>
            
            <div class="form-group">
                <label for="purpose">用途</label>
                <textarea id="purpose" name="purpose" required></textarea>
            </div>
            
            <div class="form-group">
                <button type="submit" class="btn">提交预约</button>
                <a href="${pageContext.request.contextPath}/reservation/list" class="btn btn-cancel">取消</a>
            </div>
        </form>
    </div>
    
    <script>
        // 加载场馆信息
        // function loadVenueInfo() {
        //     const venueSelect = document.getElementById('venueId');
        //     const venueId = venueSelect.value;
        //
        //     if (!venueId) {
        //         document.getElementById('venueInfo').style.display = 'none';
        //         return;
        //     }
        //
        //     const selectedOption = venueSelect.options[venueSelect.selectedIndex];
        //     const location = selectedOption.getAttribute('data-location');
        //     const capacity = selectedOption.getAttribute('data-capacity');
        //     const status = selectedOption.getAttribute('data-status');
        //
        //     document.getElementById('venueLocation').textContent = location;
        //     document.getElementById('venueCapacity').textContent = capacity;
        //     document.getElementById('venueStatus').textContent = status === 'available' ? '可用' : '维护中';
        //     document.getElementById('venueInfo').style.display = 'block';
        // }

    </script>
</body>
</html> 